<div class="row-content am-cf">
	<div class="row">
		<div class="am-u-sm-12 am-u-md-12 am-u-lg-12">
			<div class="widget am-cf">
				<div class="widget-head am-cf">
					<div class="widget-title am-fl">确认放款</div>
					<div class="widget-function am-fr">
						<a href="javascript:;" class="am-icon-cog"></a>
					</div>
				</div>
				<div class="widget-body am-fr">
					<form class="am-form tpl-form-line-form" id="lendForm" method="post" enctype="multipart/form-data">
						<div class="am-form-group">
							<label for="realName" class="am-u-sm-2 am-form-label">放款金额</label>
							<div class="am-u-sm-1">
								<input type="text" id="loanAmount" class="tpl-form-input" name="loanAmount" th:value="${loanInfo == null?'':loanInfo.loanAmount}" readonly="readonly"/> 
							</div>
							<label for="mobile" class="am-u-sm-2 am-form-label">借款人</label>
							<div class="am-u-sm-1">
								<input type="text" id="loanName" class="tpl-form-input" name="loanName" th:value="${loanInfo == null?'':loanInfo.loanName}" readonly="readonly"/> 
							</div>
							<label for="idcard" class="am-u-sm-2 am-form-label">身份证</label>
							<div class="am-u-sm-4">
								<input type="text" id="idcard" class="tpl-form-input" name="idcard"  th:value="${loanInfo == null?'':loanInfo.idcard}" readonly="readonly" /> 
							</div>
						</div>
						
						<div class="am-form-group">
							<label for="realName" class="am-u-sm-2 am-form-label">放款银行</label>
							<div class="am-u-sm-1">
								<input type="text" id="bank" class="tpl-form-input" name="bank"  th:value="${loanInfo == null?'':loanInfo.bank}" readonly="readonly"/> 
							</div>
							<label for="mobile" class="am-u-sm-2 am-form-label">支行</label>
							<div class="am-u-sm-1">
								<input type="text" id="subBank" class="tpl-form-input" name="subBank"  th:value="${loanInfo == null?'':loanInfo.subBank}" readonly="readonly"/> 
							</div>
							<label for="idcard" class="am-u-sm-2 am-form-label">卡号</label>
							<div class="am-u-sm-4">
								<input type="text" id="bankCard" class="tpl-form-input" name="bankCard"  th:value="${loanInfo == null?'':loanInfo.bankCard}" readonly="readonly" /> 
							</div>
						</div>
						
						<div class="am-form-group">
							<label for="lendTime" class="am-u-sm-2 am-form-label">放款时间</label>
							<div class="am-u-sm-5">
								<input type="text"  id="lendTime" name="lendTime" readonly="readonly" class="form-datetime-lang am-form-field" />
							</div>
							<div class="am-u-sm-3">
								<input type="hidden"  id="evidenceAddr" name="evidenceAddr" readonly="readonly" class="tpl-form-input" />
							</div>
							<div class="am-u-sm-3">
								<input type="hidden"  id="id" name="id" readonly="readonly" class="tpl-form-input" th:value="${loanInfo == null?'':loanInfo.id}"/>
							</div>
						</div>
						
						<div class="am-form-group">
							<label for="descs" class="am-u-sm-2 am-form-label">上传打款凭证
							</label>
							<div class="am-u-sm-10">
								<input id="upFile" type="file"  />
								<input id="coverImg" type="hidden"   name="coverImg"/>
							</div>
						</div>

						<div class="am-form-group">
							<div class="am-u-sm-10 am-u-sm-push-2">
								
								<button type="button" onclick="javascript:$('#lendForm').submit();"
									class="am-btn am-btn-primary tpl-btn-bg-color-success ">提交</button>
										<button type="button" onclick="loadPage('lend/lendListUI')"
									class="am-btn am-btn-success tpl-btn-bg-color-success ">返回</button>
							</div>
						</div>
					</form>
				</div>
			</div>
		</div>
	</div>

	</div>
	<script th:inline="javascript">
	<![CDATA[
		
	
	
	$('.form-datetime-lang').datetimepicker({
	    language:  'zh-CN',
	    format: 'yyyy-mm-dd hh:ii:ss',
	    todayBtn: true,
	    autoclose: true
	});
		
	validateLendForm();
	function validateLendForm(){ 
	    $('#lendForm').validate({
	        errorElement : 'span',
	        errorClass : 'am-icon-times',
	        focusInvalid : true,
	        onkeyup:false,
	        ignore : "",
	        rules : {
	        	lendTime : {
	                required : true
	            },
	            evidenceAddr : {
	            	required : true
	            }
	        },
	        messages : {
	        	lendTime : {
		            required : "请填写放款日期",
		            },
		            evidenceAddr : {
	                required : "请上传放款凭证",
	            },
	        },
	        submitHandler : function(form) {
	        	commit('lendForm', 'lend/confirmLend', 'lend/lendListUI');
	        }
	    });
	}
	
	initUpFileOne('upFile','coverImg','选择图片','');
	function initUpFileOne(id,showId,label,initImg){
		$('#'+id+'').fileinput({
			 showUpload : true,
		     showRemove : false,
		     showCaption: false,
			 showPreview : true, //是否显示预览'
		     language : 'zh',
			 uploadUrl: 'lend/uploadEvidence',
			 allowedPreviewTypes : [ 'image' ],
		     allowedFileExtensions : [ 'jpg', 'png', 'gif' ],
		     browseClass: "am-btn am-btn-danger am-btn-sm", //按钮样式
		     dropZoneEnabled: false,//是否显示拖拽区域
			 uploadAsync:false,
			 uploadClass:'btn btn-default uploadBtnColor',
			 browseIcon:'<i class="am-icon-cloud-upload"></i>',
			 browseLabel:label,
			 removeIcon: '<i class="am-icon-trash"></i>',
			 layoutTemplates:{'footer':''},
			 initialPreview:initImg,
		}).on("filebatchuploadsuccess", function(event, data) {
		    if(data.response.ret==200){
		    	$('#'+showId+'').val(data.response.data);
		    	$('#evidenceAddr').val(data.response.content.info);
		    	layer.msg('上传成功', {
		    		  icon: 1,
		    		  time: 2000 //2秒关闭（如果不配置，默认是3秒）
		    		}); 
		    } else{
		    	layer.msg('服务器错误，请稍后重试~', {
		    		  icon: 3,
		    		  time: 3000 //2秒关闭（如果不配置，默认是3秒）
		    		}); 
		    }
		}); 
	}
	
		]]>
	
	</script>